package com.wd.myhome.view.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.lifecycle.Observer
import com.wd.base.App
import com.wd.current.model.Bean.DataBean
import com.wd.live.base.BaseActivity
import com.wd.mondle_home.model.adapter.StackAdapter
import com.wd.myhome.R
import com.wd.myhome.databinding.ActivityConstellationmatchingBinding
import com.wd.myhome.viewmodel.ConstellationmatchingViewModel

class ConstellationmatchingActivity : BaseActivity<ConstellationmatchingViewModel,ActivityConstellationmatchingBinding>(R.layout.activity_constellationmatching) {

    val stackAdapter= mutableListOf<DataBean.FindRecommendConstellationBean.Result>()
    override fun dataObserver() {
        viewmodel.findRecommendConstellationData.observe(this,Observer {
            stackAdapter.addAll(it.result)
            binding.stackView.adapter = StackAdapter(this,stackAdapter)
        })

    }

    override fun initViews() {
        //请求数据
        viewmodel.getRecommendConstellationData(App.userId,App.sessionId,10,5)
        binding.back.setOnClickListener(object  : View.OnClickListener {
            override fun onClick(p0: View?) {
                finish()
            }

        })

    }

}